package com.wyg.blog.service.serviceimpl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wyg.blog.mapper.FriendSiteMapper;
import com.wyg.blog.model.user.FriendSite;
import com.wyg.blog.service.user.FriendSiteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @description:
 * @author: WYG
 * @time: 2021/1/31 9:02
 */
@Service
public class FriendSiteServiceImpl implements FriendSiteService {

    @Autowired
    FriendSiteMapper friendSiteMapper;

    @Override
    public IPage<FriendSite> selectAllSite(Page<?> page) {
        return friendSiteMapper.getAllFriendSite(page);
    }

    @Override
    public List<Map<String, String>> selectSiteInfo() {
        return friendSiteMapper.getFriendSiteInfo();
    }

    @Override
    public boolean insertSite(FriendSite friendSite) {
        return friendSiteMapper.addSite(friendSite);
    }

    @Override
    public boolean removeSite(Integer id) {
        return friendSiteMapper.deleteSite(id);
    }

    @Override
    public boolean renewSiteStatus(Integer id, boolean isAdded) {
        return friendSiteMapper.updateSiteStatus(id, isAdded);
    }

    @Override
    public boolean renewSite(FriendSite friendSite) {
        return friendSiteMapper.updateSite(friendSite);
    }

    @Override
    public boolean selectStatus(Integer id) {
        return friendSiteMapper.getStatus(id);
    }
}
